{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Running D-Tale from an ipython notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using a pandas.DataFrame or pandas.Series\n",
    "The following is hopefully sufficient for most applications (feedback welcome!):\n",
    "```\n",
    "import dtale\n",
    "dtale.show(df)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2019-09-04 07:13:56,751 - INFO     - D-Tale started at: http://aschonfeld:41233\n"
     ]
    }
   ],
   "source": [
    "import dtale\n",
    "import pandas as pd\n",
    "\n",
    "def build_data():\n",
    "    for i in range(100):\n",
    "        rec = dict(date=pd.Timestamp('20000101'), security_id=i, foo=i, bar=1.2345678)\n",
    "        for j in range(50):\n",
    "            rec[str(j)] = j\n",
    "        yield rec\n",
    "\n",
    "df = pd.DataFrame(list(build_data())).set_index(['date','security_id'])\n",
    "\n",
    "dtale.show(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
